package com.nameless.controller;

import com.nameless.entity.MaintainShop;
import com.nameless.service.MaintainShopService;
import com.nameless.vo.BrandVo;
import com.nameless.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import sun.applet.Main;

import java.time.LocalDateTime;

/**
 * @author keluoyisi
 * @program: car-parent
 * @description: 维修管理方面
 * @date 2023-02-28 14:15:24
 */
@RestController
@RequestMapping("/car/maintainShop")
public class MaintainShopController {
    @Autowired
    private MaintainShopService maintainShopService;

    @GetMapping("/queryAll")
    public Result queryAll(){
        return maintainShopService.queryAll();
    }

    @PostMapping("/queryAllByParam")
    public Result queryAllByParam(@RequestBody BrandVo brandVo){
        return maintainShopService.queryAllByParam(brandVo);
    }

    @PutMapping("/update")
    public Result updateMaintainShop(@RequestBody MaintainShop maintainShop){
        return maintainShopService.updateMaintainShop(maintainShop);
    }

    @PostMapping("/insert")
    public Result insertMaintainShop(@RequestBody MaintainShop maintainShop){
        maintainShop.setAddtime(LocalDateTime.now());
        return maintainShopService.insertMaintainShop(maintainShop);
    }

    @DeleteMapping("/deleteById")
    public Result deleteById(Integer id){
        return maintainShopService.deleteMaintainShopById(id);
    }
}
